package org.mii.safeguard_v1.tools.itext;

import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfWriter;

public class Demo {
	public static void main(String[] args) throws Exception, DocumentException {
		Document doc = new Document(PageSize.B5, 0, 0, 0, 0);
		String file = "d:/pdfblod.pdf";
		PdfWriter writer = PdfWriter.getInstance(doc,
				new FileOutputStream(file));
		doc.open();
//		BaseFont bfChinese = BaseFont.createFont("STSong-Light",
//				"UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
		BaseFont bfChinese = BaseFont.createFont("STSong-Light",
				"UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
//		bfChinese = BaseFont.createFont("/font/simhei.ttf", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);   
//		bfChinese = BaseFont.createFont("/font/STKAITI.TTF", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);   
//		bfChinese = BaseFont.createFont("/font/STLITI.TTF", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);   

/*		Font.HELVETICA;
		Font.STRIKETHRU;
		Font.SYMBOL;
		Font.TIMES_ROMAN;
		Font.UNDEFINED;
		Font.UNDERLINE;*/
		
		Font FontChinese1 = new Font(bfChinese, 14, Font.HELVETICA);
		Font FontChinese2 = new Font(bfChinese, 13, Font.STRIKETHRU);
		Font FontChinese3 = new Font(bfChinese, 14, Font.SYMBOL);
		Font FontChinese4 = new Font(bfChinese, 15, Font.TIMES_ROMAN);
		Font FontChinese5 = new Font(bfChinese, 16, Font.UNDEFINED);
		Font FontChinese6 = new Font(bfChinese, 17, Font.UNDERLINE);
		Font FontChinese7 = new Font(bfChinese, 18, Font.ITALIC);
		Font FontChinese8 = new Font(bfChinese, 14, Font.BOLD);
		Font FontChinese9 = new Font(bfChinese, 19, Font.NORMAL);
		Font FontChinese10 = new Font(bfChinese, 19, Font.ZAPFDINGBATS);
		
		Phrase p=new Phrase();
		
		Paragraph t = new Paragraph("JAVA世纪网(www.java2000.net)", FontChinese8);
		t.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(t);

		Paragraph lawDb = new Paragraph(
				"JAVA世纪网(www.java2000.net)", FontChinese1);
		lawDb.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(lawDb);
		Paragraph lawDb2 = new Paragraph(
				"提供最全面最实用的Java面试题,STRIKETHRU", FontChinese2);
		lawDb2.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(lawDb2);
		Paragraph lawDb3 = new Paragraph(
				"提供最全面最实用的Java面试题,SYMBOL", FontChinese3);
		lawDb3.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(lawDb3);
		Paragraph lawDb4 = new Paragraph(
				"提供最全面最实用的Java面试题,TIMES_ROMAN", FontChinese4);
		lawDb4.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(lawDb4);
		Paragraph lawDb5 = new Paragraph(
				"提供最全面最实用的Java面试题,UNDEFINED", FontChinese5);
		lawDb5.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(lawDb5);
		Paragraph lawDb6 = new Paragraph(
				"提供最全面最实用的Java面试题,UNDERLINE", FontChinese6);
		lawDb6.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(lawDb6);
		Paragraph lawDb7 = new Paragraph(
				"提供最全面最实用的Java面试题,ITALIC", FontChinese7);
		lawDb7.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(lawDb7);
		Paragraph lawDb9 = new Paragraph(
				"提供最全面最实用的Java面试题,NORMAL", FontChinese9);
		lawDb9.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(lawDb9);
		Paragraph lawDb10 = new Paragraph(
				"提供最全面最实用的Java面试题,ZAPFDINGBATS", FontChinese10);
		lawDb10.setAlignment(Paragraph.ALIGN_CENTER);
		doc.add(lawDb10);

		doc.close();
		writer.close();
	}
}
